<%--
  Created by IntelliJ IDEA.
  User: notyoukennk
  Date: 2022/11/30
  Time: 14:23
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="java.sql.*" %>
<%@ page import="ProjectManagement.DobConn" %>
<%@ page import="com.spm.pojo.Teacher" %>
<html>
<head>
    <title>课程</title>
    <style>
        table {
            border-collapse: collapse;
            width: 100%;
        }

        th, td {
            padding: 8px;
            text-align: left;
            border-bottom: 1px solid #ddd;
        }
    </style>
</head>
<body>
<table>
    <tr>
        <th>课程号</th>
        <th>课程余量</th>
        <th>班级总量</th>
        <th></th>
    </tr>
    <%
        try {
            Teacher teacher=(Teacher) session.getAttribute("teacher");
            String Tid=teacher.getTid();
            Connection conn = DobConn.getConn();
            Statement stat = conn.createStatement();
            String sql1 = "SELECT * FROM Teacher_R_Course where Tid="+Tid+" order by Cno asc";
            ResultSet rs = null;
            rs = stat.executeQuery(sql1);
            while(rs.next()){
                String Cno = rs.getString("Cno");
                String Csurplus= String.valueOf(rs.getInt("Csurplus"));
                String Capacity = String.valueOf(rs.getInt("Capacity"));
                out.print("<tr>\n" +
                        "        <td>"+Cno+"</td>\n" +
                        "        <td>"+Csurplus+"</td>\n" +
                        "        <td>"+Capacity+"</td>\n" +
                        "        <td ><a href='teacherclassselection?courseid="+Cno+"'>查询</a>\n" +
                        "        </td>\n" +
                        "    </tr>");
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    %>
</table>
</body>
</html>

</body>
</html>
